import { Dispatch, useReducer } from "react";

export interface ScrollTemolateState {
    templateType: 'A' | 'B' | 'C'
}

const initialState: ScrollTemolateState = {
    templateType: 'A'
};

interface ScrollTemplateAction {
    type: 'SET_TEMPLATE_TYPE';
    payload: 'A' | 'B' | 'C';
}

const scrollTemplateReducer = (state: ScrollTemolateState, action: ScrollTemplateAction): ScrollTemolateState => {
    switch (action.type) {
        
        case 'SET_TEMPLATE_TYPE':
            console.log("🚀 ~ scrollTemplateReducer ~ action.type:", action);
            return {
                ...state,
                templateType: action.payload
            };
        default:
            return state;
    }
};

export const useScrollTemplateReducer = (): [ScrollTemolateState, Dispatch<ScrollTemplateAction>] => useReducer(scrollTemplateReducer, initialState);

